<script setup lang='ts'>
import { PureTableBar } from "@/components/RePureTableBar";
import { useFincilaAssetPools } from "./hooks/FincilaAssetPools";
const {
  rules,
  columns,
  loading,
  dataList,
  pagination,
  handleSizeChange,
  handleCurrentChange,
  DialogVisible,
  EntryPlatform,
  RefEntryPlatform,
  CloseEntryPlatform,
  SubtimEntryPlatform,
  projectList,
  securitiesList,
  creditRatingList,
  changeProject,
  check,
  showDetail,
  approverList
} = useFincilaAssetPools()
</script>
    <!-- 入住电商平台 -->
<template>
  <div class="main">
    <PureTableBar title="资产证券化项目列表" class="list_hei">
      <template #buttons>
        <el-button type="primary" @click="DialogVisible = true">组建资产池 </el-button>
      </template>
      <template v-slot="{ size, checkList }">
        <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" adaptive :loading="loading"
          size="small" :data="dataList" max-height="600" :columns="columns" :checkList="checkList"
          :pagination="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :header-cell-style="{
            background: 'var(--el-table-row-hover-bg-color)',
            color: 'var(--el-text-color-primary)'
          }">
          <template #operation="{ row }">
            <el-button type='primary' size="small" text @click="check(row)">
              查看资产池特征
              <!-- 激活 -->
            </el-button>
          </template>
        </pure-table>
      </template>
    </PureTableBar>
  </div>

  <ReDialog :width="600" :height="500" :models="DialogVisible" @Closes="CloseEntryPlatform(RefEntryPlatform)">
    <template #header>
      <h2 style=" text-align: center;">组建资产池窗口</h2>
    </template>
    <template #main>
      <el-scrollbar height="420px">
        <!-- 入驻平台窗口 -->
        <el-form label-width="180px" ref="RefEntryPlatform" :rules="rules" :model="EntryPlatform">
          <div>
            <el-form-item label="资产证券化项目名称：" prop="projectName">
              <el-select placeholder="请选择" v-model="EntryPlatform.projectName" v-if="!showDetail">
                <el-option v-for="item in projectList" :key="item.purchaseName" :label="item.purchaseName"
                  collapse-tags-tooltip :value="item.purchaseName" @click="changeProject(item)" />
              </el-select>
              <span v-else="showDetail">{{ EntryPlatform.projectName }}</span>
            </el-form-item>
            <el-form-item label="基础资产类型：">
              应收账款债权
            </el-form-item>
            <el-form-item label="发起人：" prop="supplerName">
              {{ EntryPlatform.supplerName }}
            </el-form-item>
            <el-form-item label="证券承销商：" prop="securities">
              <el-select placeholder="请选择" v-model="EntryPlatform.securities" :disabled="showDetail" collapse-tags-tooltip
                class="!w-[220px]">
                <el-option v-for="item in securitiesList" :key="item.dictId" :label="item.dictName"
                  :value="item.dictId" />
              </el-select>
            </el-form-item>
            <el-form-item label="证券交易所：" prop="approver">
              <el-select placeholder="请选择证券交易所" v-model="EntryPlatform.approver" :disabled="showDetail"
                collapse-tags-tooltip class="!w-[220px]">
                <el-option v-for="item in approverList" :key="item.dictName" :label="item.dictName"
                  :value="item.dictName" />
              </el-select>
            </el-form-item>
            <el-form-item label="信用评级机构：" prop="creditRating">
              <el-select placeholder="请选择" v-model="EntryPlatform.creditRating" :disabled="showDetail"
                collapse-tags-tooltip class="!w-[220px]">
                <el-option v-for="item in creditRatingList" :key="item.dictId" :label="item.dictName"
                  :value="item.dictId" />
              </el-select>
            </el-form-item>
            <el-form-item label="应收账款债权余额：" prop="money">
              {{ EntryPlatform.money }} &nbsp;元
            </el-form-item>
            <el-form-item label="应收账款收益率：" prop="endTime">
              9.125%
            </el-form-item>
            <el-form-item label="应收账款剩余平均期限：" prop="leaveDay">
              {{ EntryPlatform.leaveDay }}天
            </el-form-item>
          </div>
        </el-form>
      </el-scrollbar>
    </template>
    <template #footer>
      <el-button type="primary" @click="SubtimEntryPlatform(RefEntryPlatform)" v-if="!showDetail"> 确定 </el-button>
      <el-button @click="CloseEntryPlatform(RefEntryPlatform)"> 取消 </el-button>
    </template>
  </ReDialog>
</template>

<style scoped lang="scss">
@import url(@/style/CreditComm.scss);

:deep(.el-dialog__footer) {
  text-align: center;
}

:deep(.el-form-item__label) {
  font-weight: 700
}
</style>
